
namespace Core.Contracts.Interfaces
{
    using System.Collections.Generic;
    using System;

    /// <summary>
    /// Repository interface contract
    /// </summary>
    public interface IRepository : IIsDisposed
    {
        /// <summary>
        /// Intializes
        /// </summary>
        void Initialize();
        /// <summary>
        /// Obtains the robots list
        /// </summary>
        IEnumerable<IRobot> Robots { get; }
        /// <summary>
        /// Obtains the modules list
        /// </summary>
        IEnumerable<IModule> Modules { get; }
        /// <summary>
        /// Obtains the ammunitions list
        /// </summary>
        IEnumerable<IAmmunition> Ammunitions { get; }
        /// <summary>
        /// Loads a new instance of an item based on its name
        /// </summary>
        /// <typeparam name="T">The type of the instance to create</typeparam>
        /// <param name="name">The name of the item</param>
        /// <returns>A new instance of T or null</returns>
        T LoadByName<T>(string name) where T : class, ICloneable;
        /// <summary>
        /// Enumerates items using an XPath query
        /// </summary>
        /// <typeparam name="T">The type of item</typeparam>
        /// <param name="xpath">An XPath query</param>
        /// <returns>An IEnumerable of T or null</returns>
        IEnumerable<T> LoadByPath<T>(string xpath) where T : class, ICloneable;
        /// <summary>
        /// Determines if an item exists and if so, creates a new instance
        /// </summary>
        /// <typeparam name="T">The type of the instance</typeparam>
        /// <param name="name">The name of the item</param>
        /// <param name="instance">A new instance of T if the item exists otherwise null</param>
        /// <returns>True if the item exists otherwise false</returns>
        bool Exists<T>(string name, out T instance) where T : class, ICloneable;


    }
}